Skip to content

Fix CodeQL security alerts #122 and #123 - #2705

Merged
Christdej merged 2 commits into
equinor:mainfrom
Christdej:fix/security-alerts-122-123
May 11, 2026
Merged

Fix CodeQL security alerts #122 and #123#2705
Christdej merged 2 commits into
equinor:mainfrom
Christdej:fix/security-alerts-122-123

Conversation

@Christdej

@Christdej Christdej commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix log-forging (CWE-117) in AreaPolygonService by logging numeric coordinates and stripping CR/LF from missionTask.Id via the existing Sanitize helper (alert #123).
  • Add an explicit least-privilege permissions: contents: read block to validate_dotnet_migrations_against_temp_db.yml (alert #122).

Details

  • backend/api/Services/AreaPolygonService.cs: replace LogWarning of the user-influenced Position object with explicit X/Y/Z doubles (which are not log-forging sinks) and a sanitized missionTask.Id. Adds using Api.Utilities;.
  • .github/workflows/validate_dotnet_migrations_against_temp_db.yml: declare workflow-level permissions so the GITHUB_TOKEN no longer relies on the repository default.

Verification

  • dotnet build from backend/api succeeds with 0 warnings / 0 errors.

Closes the following code-scanning alerts:

@Christdej
Christdej requested a review from nicholasdalhaug May 11, 2026 08:21
@Christdej Christdej self-assigned this May 11, 2026
@Christdej
Christdej force-pushed the fix/security-alerts-122-123 branch from 7a4d4e6 to 47d964d Compare May 11, 2026 10:00
Christdej added 2 commits May 11, 2026 13:18
Add an explicit top-level permissions block (contents: read) to the
validate_dotnet_migrations_against_temp_db workflow so the GITHUB_TOKEN
no longer relies on repository defaults. Addresses CodeQL alert
actions/missing-workflow-permissions.

Closes equinor#122 (code-scanning alert)
Replace logging of the user-influenced Position object with explicit
numeric X/Y/Z coordinates and a sanitized task id. This addresses
CodeQL alert cs/log-forging (CWE-117) where untrusted input from the
custom mission endpoint could flow into log entries and forge new
lines.

Also make Sanitize.SanitizeUserInput null-safe by accepting a nullable
string and returning string.Empty for null input rather than throwing
NullReferenceException, removing a sharp edge for current and future
callers.

Closes equinor#123 (code-scanning alert)
@Christdej
Christdej force-pushed the fix/security-alerts-122-123 branch from 47d964d to e45e704 Compare May 11, 2026 11:18
@Christdej
Christdej merged commit d64a752 into equinor:main May 11, 2026
13 checks passed
@Christdej
Christdej deleted the fix/security-alerts-122-123 branch May 11, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants